/* -*-c++-*- */
/* osgGIS - GIS Library for OpenSceneGraph
 * Copyright 2007-2008 Glenn Waldron and Pelican Ventures, Inc.
 * http://osggis.org
 *
 * osgGIS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

#ifndef _OSGGISPROJECTS_MAP_LAYER_LOD_H_
#define _OSGGISPROJECTS_MAP_LAYER_LOD_H_ 1

#include <osgGISProjects/Common>
#include <osgGIS/FeatureLayer>
#include <osgGIS/FilterGraph>
#include <osgGIS/Session>
#include <osgGIS/ResourcePackager>
#include <osg/BoundingSphere>

using namespace osgGIS;

namespace osgGISProjects
{
    /* (internal)
     * A single level of detail for a MapLayer.
     */
    class MapLayerLevelOfDetail : public osg::Referenced
    {
    public:
        MapLayerLevelOfDetail( 
            FeatureLayer* layer,
            FilterGraph* graph,
            const Properties& env_props,
            ResourcePackager* packager,
            float min_range,
            float max_range,
            bool replace_previous,
            unsigned int depth,
            osg::Referenced* user_data);

        FeatureLayer* getFeatureLayer() const;
        FilterGraph* getFilterGraph() const;
        float getMinRange() const;
        float getMaxRange() const;
        bool getReplacePrevious() const;
        unsigned int getDepth() const;
        ResourcePackager* getResourcePackager() const;
        osg::Referenced* getUserData() const;
        const Properties& getEnvProperties() const;

    private:
        osg::ref_ptr<FeatureLayer>     layer;
        osg::ref_ptr<FilterGraph>      graph;
        Properties                     env_props;
        osg::ref_ptr<ResourcePackager> packager;
        float                          min_range, max_range;
        bool                           replace_previous;
        unsigned int                   depth;
        osg::ref_ptr<osg::Referenced>  user_data;
    };

    typedef std::vector<osg::ref_ptr<MapLayerLevelOfDetail> > MapLayerLevelsOfDetail;
}

#endif // _OSGGISPROJECTS_MAP_LAYER_LOD_H_

